package yqt.com.cnki.dao.impl;

import cnki.tpi.kbatis.sqlsession.SqlSession;
import cnki.tpi.kbatis.utils.DataSourceUtil;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RequestMapping;
import yqt.com.cnki.bo.KYDABo;
import yqt.com.cnki.dao.IKYDADao;
import yqt.com.cnki.po.KYDAPo;
import yqt.com.cnki.po.KeyValuePo;

import java.util.List;

/**
 * Description:
 *
 * @author BaiGe
 * @date: 2021/11/19 16:55
 * @Version 1.0
 */
@Repository
public class KYDADaoImpl  implements IKYDADao {
    @Override
    public List<KeyValuePo> getKYDASort() {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "yqt.com.cnki.dao.IKYDADao.getKYDASort";
        return sqlSession.selectList(statementId, null, false);
    }

    @Override
    public List<KYDAPo> getKYDABySort_LimitFive(String sortCode) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "yqt.com.cnki.dao.IKYDADao.getKYDABySort_LimitFive";
        return sqlSession.selectList(statementId, sortCode, false);
    }

    @Override
    public KYDAPo getKYDAById(String sysId) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "yqt.com.cnki.dao.IKYDADao.getKYDAById";
        return sqlSession.selectOne(statementId,sysId,false);
    }

    @Override
    public List<KYDAPo> complexSearch_list(KYDABo kydaBo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "yqt.com.cnki.dao.IKYDADao.complexSearch_list";
        return sqlSession.selectList(statementId, kydaBo, true);
    }

    @Override
    public long complexSearch_Count(KYDABo kydaBo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "yqt.com.cnki.dao.IKYDADao.complexSearch_Count";
        return sqlSession.getCount(statementId, kydaBo);
    }
}
